1 module hip.jni.android.input;
2 
3 /*
4  * Copyright (C) 2010 The Android Open Source Project
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  *      http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  */
18 
19 /**
20  * @addtogroup Input
21  * @{
22  */
23 
24 /**
25  * @file input.h
26  */
27 
28 // #include <sys/cdefs.h>
29 
30 /******************************************************************
31  *
32  * IMPORTANT NOTICE:
33  *
34  *   This file is part of Android's set of stable system headers
35  *   exposed by the Android NDK (Native Development Kit).
36  *
37  *   Third-party source AND binary code relies on the definitions
38  *   here to be FROZEN ON ALL UPCOMING PLATFORM RELEASES.
39  *
40  *   - DO NOT MODIFY ENUMS (EXCEPT IF YOU ADD NEW 32-BIT VALUES)
41  *   - DO NOT MODIFY CONSTANTS OR FUNCTIONAL MACROS
42  *   - DO NOT CHANGE THE SIGNATURE OF FUNCTIONS IN ANY WAY
43  *   - DO NOT CHANGE THE LAYOUT OR SIZE OF STRUCTURES
44  */
45 
46 /*
47  * Structures and functions to receive and process input events in
48  * native code.
49  *
50  * NOTE: These functions MUST be implemented by /system/lib/libui.so
51  */
52 
53 import core.stdc.stdint;
54 import hip.jni.android.keycodes;
55 import hip.jni.android.looper;
56 
57 extern(C):
58 
59 /**
60  * Key states (may be returned by queries about the current state of a
61  * particular key code, scan code or switch).
62  */
63 enum {
64     /** The key state is unknown or the requested key itself is not supported. */
65     AKEY_STATE_UNKNOWN = -1,
66 
67     /** The key is up. */
68     AKEY_STATE_UP = 0,
69 
70     /** The key is down. */
71     AKEY_STATE_DOWN = 1,
72 
73     /** The key is down but is a virtual key press that is being emulated by the system. */
74     AKEY_STATE_VIRTUAL = 2
75 }
76 
77 /**
78  * Meta key / modifier state.
79  */
80 enum {
81     /** No meta keys are pressed. */
82     AMETA_NONE = 0,
83 
84     /** This mask is used to check whether one of the ALT meta keys is pressed. */
85     AMETA_ALT_ON = 0x02,
86 
87     /** This mask is used to check whether the left ALT meta key is pressed. */
88     AMETA_ALT_LEFT_ON = 0x10,
89 
90     /** This mask is used to check whether the right ALT meta key is pressed. */
91     AMETA_ALT_RIGHT_ON = 0x20,
92 
93     /** This mask is used to check whether one of the SHIFT meta keys is pressed. */
94     AMETA_SHIFT_ON = 0x01,
95 
96     /** This mask is used to check whether the left SHIFT meta key is pressed. */
97     AMETA_SHIFT_LEFT_ON = 0x40,
98 
99     /** This mask is used to check whether the right SHIFT meta key is pressed. */
100     AMETA_SHIFT_RIGHT_ON = 0x80,
101 
102     /** This mask is used to check whether the SYM meta key is pressed. */
103     AMETA_SYM_ON = 0x04,
104 
105     /** This mask is used to check whether the FUNCTION meta key is pressed. */
106     AMETA_FUNCTION_ON = 0x08,
107 
108     /** This mask is used to check whether one of the CTRL meta keys is pressed. */
109     AMETA_CTRL_ON = 0x1000,
110 
111     /** This mask is used to check whether the left CTRL meta key is pressed. */
112     AMETA_CTRL_LEFT_ON = 0x2000,
113 
114     /** This mask is used to check whether the right CTRL meta key is pressed. */
115     AMETA_CTRL_RIGHT_ON = 0x4000,
116 
117     /** This mask is used to check whether one of the META meta keys is pressed. */
118     AMETA_META_ON = 0x10000,
119 
120     /** This mask is used to check whether the left META meta key is pressed. */
121     AMETA_META_LEFT_ON = 0x20000,
122 
123     /** This mask is used to check whether the right META meta key is pressed. */
124     AMETA_META_RIGHT_ON = 0x40000,
125 
126     /** This mask is used to check whether the CAPS LOCK meta key is on. */
127     AMETA_CAPS_LOCK_ON = 0x100000,
128 
129     /** This mask is used to check whether the NUM LOCK meta key is on. */
130     AMETA_NUM_LOCK_ON = 0x200000,
131 
132     /** This mask is used to check whether the SCROLL LOCK meta key is on. */
133     AMETA_SCROLL_LOCK_ON = 0x400000,
134 }
135 
136 /**
137  * Input events.
138  *
139  * Input events are opaque structures.  Use the provided accessors functions to
140  * read their properties.
141  */
142 struct AInputEvent;
143 
144 /**
145  * Input event types.
146  */
147 enum {
148     /** Indicates that the input event is a key event. */
149     AINPUT_EVENT_TYPE_KEY = 1,
150 
151     /** Indicates that the input event is a motion event. */
152     AINPUT_EVENT_TYPE_MOTION = 2,
153 
154     /** Focus event */
155     AINPUT_EVENT_TYPE_FOCUS = 3,
156 }
157 
158 /**
159  * Key event actions.
160  */
161 enum {
162     /** The key has been pressed down. */
163     AKEY_EVENT_ACTION_DOWN = 0,
164 
165     /** The key has been released. */
166     AKEY_EVENT_ACTION_UP = 1,
167 
168     /**
169      * Multiple duplicate key events have occurred in a row, or a
170      * complex string is being delivered.  The repeat_count property
171      * of the key event contains the number of times the given key
172      * code should be executed.
173      */
174     AKEY_EVENT_ACTION_MULTIPLE = 2
175 }
176 
177 /**
178  * Key event flags.
179  */
180 enum {
181     /** This mask is set if the device woke because of this key event. */
182     AKEY_EVENT_FLAG_WOKE_HERE = 0x1,
183 
184     /** This mask is set if the key event was generated by a software keyboard. */
185     AKEY_EVENT_FLAG_SOFT_KEYBOARD = 0x2,
186 
187     /** This mask is set if we don't want the key event to cause us to leave touch mode. */
188     AKEY_EVENT_FLAG_KEEP_TOUCH_MODE = 0x4,
189 
190     /**
191      * This mask is set if an event was known to come from a trusted
192      * part of the system.  That is, the event is known to come from
193      * the user, and could not have been spoofed by a third party
194      * component.
195      */
196     AKEY_EVENT_FLAG_FROM_SYSTEM = 0x8,
197 
198     /**
199      * This mask is used for compatibility, to identify enter keys that are
200      * coming from an IME whose enter key has been auto-labelled "next" or
201      * "done".  This allows TextView to dispatch these as normal enter keys
202      * for old applications, but still do the appropriate action when
203      * receiving them.
204      */
205     AKEY_EVENT_FLAG_EDITOR_ACTION = 0x10,
206 
207     /**
208      * When associated with up key events, this indicates that the key press
209      * has been canceled.  Typically this is used with virtual touch screen
210      * keys, where the user can slide from the virtual key area on to the
211      * display: in that case, the application will receive a canceled up
212      * event and should not perform the action normally associated with the
213      * key.  Note that for this to work, the application can not perform an
214      * action for a key until it receives an up or the long press timeout has
215      * expired.
216      */
217     AKEY_EVENT_FLAG_CANCELED = 0x20,
218 
219     /**
220      * This key event was generated by a virtual (on-screen) hard key area.
221      * Typically this is an area of the touchscreen, outside of the regular
222      * display, dedicated to "hardware" buttons.
223      */
224     AKEY_EVENT_FLAG_VIRTUAL_HARD_KEY = 0x40,
225 
226     /**
227      * This flag is set for the first key repeat that occurs after the
228      * long press timeout.
229      */
230     AKEY_EVENT_FLAG_LONG_PRESS = 0x80,
231 
232     /**
233      * Set when a key event has AKEY_EVENT_FLAG_CANCELED set because a long
234      * press action was executed while it was down.
235      */
236     AKEY_EVENT_FLAG_CANCELED_LONG_PRESS = 0x100,
237 
238     /**
239      * Set for AKEY_EVENT_ACTION_UP when this event's key code is still being
240      * tracked from its initial down.  That is, somebody requested that tracking
241      * started on the key down and a long press has not caused
242      * the tracking to be canceled.
243      */
244     AKEY_EVENT_FLAG_TRACKING = 0x200,
245 
246     /**
247      * Set when a key event has been synthesized to implement default behavior
248      * for an event that the application did not handle.
249      * Fallback key events are generated by unhandled trackball motions
250      * (to emulate a directional keypad) and by certain unhandled key presses
251      * that are declared in the key map (such as special function numeric keypad
252      * keys when numlock is off).
253      */
254     AKEY_EVENT_FLAG_FALLBACK = 0x400,
255 }
256 
257 /**
258  * Bit shift for the action bits holding the pointer index as
259  * defined by AMOTION_EVENT_ACTION_POINTER_INDEX_MASK.
260  */
261 enum AMOTION_EVENT_ACTION_POINTER_INDEX_SHIFT = 8;
262 
263 /** Motion event actions */
264 enum {
265     /** Bit mask of the parts of the action code that are the action itself. */
266     AMOTION_EVENT_ACTION_MASK = 0xff,
267 
268     /**
269      * Bits in the action code that represent a pointer index, used with
270      * AMOTION_EVENT_ACTION_POINTER_DOWN and AMOTION_EVENT_ACTION_POINTER_UP.  Shifting
271      * down by AMOTION_EVENT_ACTION_POINTER_INDEX_SHIFT provides the actual pointer
272      * index where the data for the pointer going up or down can be found.
273      */
274     AMOTION_EVENT_ACTION_POINTER_INDEX_MASK  = 0xff00,
275 
276     /** A pressed gesture has started, the motion contains the initial starting location. */
277     AMOTION_EVENT_ACTION_DOWN = 0,
278 
279     /**
280      * A pressed gesture has finished, the motion contains the final release location
281      * as well as any intermediate points since the last down or move event.
282      */
283     AMOTION_EVENT_ACTION_UP = 1,
284 
285     /**
286      * A change has happened during a press gesture (between AMOTION_EVENT_ACTION_DOWN and
287      * AMOTION_EVENT_ACTION_UP).  The motion contains the most recent point, as well as
288      * any intermediate points since the last down or move event.
289      */
290     AMOTION_EVENT_ACTION_MOVE = 2,
291 
292     /**
293      * The current gesture has been aborted.
294      * You will not receive any more points in it.  You should treat this as
295      * an up event, but not perform any action that you normally would.
296      */
297     AMOTION_EVENT_ACTION_CANCEL = 3,
298 
299     /**
300      * A movement has happened outside of the normal bounds of the UI element.
301      * This does not provide a full gesture, but only the initial location of the movement/touch.
302      */
303     AMOTION_EVENT_ACTION_OUTSIDE = 4,
304 
305     /**
306      * A non-primary pointer has gone down.
307      * The bits in AMOTION_EVENT_ACTION_POINTER_INDEX_MASK indicate which pointer changed.
308      */
309     AMOTION_EVENT_ACTION_POINTER_DOWN = 5,
310 
311     /**
312      * A non-primary pointer has gone up.
313      * The bits in AMOTION_EVENT_ACTION_POINTER_INDEX_MASK indicate which pointer changed.
314      */
315     AMOTION_EVENT_ACTION_POINTER_UP = 6,
316 
317     /**
318      * A change happened but the pointer is not down (unlike AMOTION_EVENT_ACTION_MOVE).
319      * The motion contains the most recent point, as well as any intermediate points since
320      * the last hover move event.
321      */
322     AMOTION_EVENT_ACTION_HOVER_MOVE = 7,
323 
324     /**
325      * The motion event contains relative vertical and/or horizontal scroll offsets.
326      * Use getAxisValue to retrieve the information from AMOTION_EVENT_AXIS_VSCROLL
327      * and AMOTION_EVENT_AXIS_HSCROLL.
328      * The pointer may or may not be down when this event is dispatched.
329      * This action is always delivered to the winder under the pointer, which
330      * may not be the window currently touched.
331      */
332     AMOTION_EVENT_ACTION_SCROLL = 8,
333 
334     /** The pointer is not down but has entered the boundaries of a window or view. */
335     AMOTION_EVENT_ACTION_HOVER_ENTER = 9,
336 
337     /** The pointer is not down but has exited the boundaries of a window or view. */
338     AMOTION_EVENT_ACTION_HOVER_EXIT = 10,
339 
340     /* One or more buttons have been pressed. */
341     AMOTION_EVENT_ACTION_BUTTON_PRESS = 11,
342 
343     /* One or more buttons have been released. */
344     AMOTION_EVENT_ACTION_BUTTON_RELEASE = 12,
345 }
346 
347 /**
348  * Motion event flags.
349  */
350 enum {
351     /**
352      * This flag indicates that the window that received this motion event is partly
353      * or wholly obscured by another visible window above it.  This flag is set to true
354      * even if the event did not directly pass through the obscured area.
355      * A security sensitive application can check this flag to identify situations in which
356      * a malicious application may have covered up part of its content for the purpose
357      * of misleading the user or hijacking touches.  An appropriate response might be
358      * to drop the suspect touches or to take additional precautions to confirm the user's
359      * actual intent.
360      */
361     AMOTION_EVENT_FLAG_WINDOW_IS_OBSCURED = 0x1,
362 };
363 
364 /**
365  * Motion event edge touch flags.
366  */
367 enum {
368     /** No edges intersected. */
369     AMOTION_EVENT_EDGE_FLAG_NONE = 0,
370 
371     /** Flag indicating the motion event intersected the top edge of the screen. */
372     AMOTION_EVENT_EDGE_FLAG_TOP = 0x01,
373 
374     /** Flag indicating the motion event intersected the bottom edge of the screen. */
375     AMOTION_EVENT_EDGE_FLAG_BOTTOM = 0x02,
376 
377     /** Flag indicating the motion event intersected the left edge of the screen. */
378     AMOTION_EVENT_EDGE_FLAG_LEFT = 0x04,
379 
380     /** Flag indicating the motion event intersected the right edge of the screen. */
381     AMOTION_EVENT_EDGE_FLAG_RIGHT = 0x08
382 }
383 
384 /**
385  * Constants that identify each individual axis of a motion event.
386  * @anchor AMOTION_EVENT_AXIS
387  */
388 enum {
389     /**
390      * Axis constant: X axis of a motion event.
391      *
392      * - For a touch screen, reports the absolute X screen position of the center of
393      * the touch contact area.  The units are display pixels.
394      * - For a touch pad, reports the absolute X surface position of the center of the touch
395      * contact area. The units are device-dependent.
396      * - For a mouse, reports the absolute X screen position of the mouse pointer.
397      * The units are display pixels.
398      * - For a trackball, reports the relative horizontal displacement of the trackball.
399      * The value is normalized to a range from -1.0 (left) to 1.0 (right).
400      * - For a joystick, reports the absolute X position of the joystick.
401      * The value is normalized to a range from -1.0 (left) to 1.0 (right).
402      */
403     AMOTION_EVENT_AXIS_X = 0,
404     /**
405      * Axis constant: Y axis of a motion event.
406      *
407      * - For a touch screen, reports the absolute Y screen position of the center of
408      * the touch contact area.  The units are display pixels.
409      * - For a touch pad, reports the absolute Y surface position of the center of the touch
410      * contact area. The units are device-dependent.
411      * - For a mouse, reports the absolute Y screen position of the mouse pointer.
412      * The units are display pixels.
413      * - For a trackball, reports the relative vertical displacement of the trackball.
414      * The value is normalized to a range from -1.0 (up) to 1.0 (down).
415      * - For a joystick, reports the absolute Y position of the joystick.
416      * The value is normalized to a range from -1.0 (up or far) to 1.0 (down or near).
417      */
418     AMOTION_EVENT_AXIS_Y = 1,
419     /**
420      * Axis constant: Pressure axis of a motion event.
421      *
422      * - For a touch screen or touch pad, reports the approximate pressure applied to the surface
423      * by a finger or other tool.  The value is normalized to a range from
424      * 0 (no pressure at all) to 1 (normal pressure), although values higher than 1
425      * may be generated depending on the calibration of the input device.
426      * - For a trackball, the value is set to 1 if the trackball button is pressed
427      * or 0 otherwise.
428      * - For a mouse, the value is set to 1 if the primary mouse button is pressed
429      * or 0 otherwise.
430      */
431     AMOTION_EVENT_AXIS_PRESSURE = 2,
432     /**
433      * Axis constant: Size axis of a motion event.
434      *
435      * - For a touch screen or touch pad, reports the approximate size of the contact area in
436      * relation to the maximum detectable size for the device.  The value is normalized
437      * to a range from 0 (smallest detectable size) to 1 (largest detectable size),
438      * although it is not a linear scale. This value is of limited use.
439      * To obtain calibrated size information, see
440      * {@link AMOTION_EVENT_AXIS_TOUCH_MAJOR} or {@link AMOTION_EVENT_AXIS_TOOL_MAJOR}.
441      */
442     AMOTION_EVENT_AXIS_SIZE = 3,
443     /**
444      * Axis constant: TouchMajor axis of a motion event.
445      *
446      * - For a touch screen, reports the length of the major axis of an ellipse that
447      * represents the touch area at the point of contact.
448      * The units are display pixels.
449      * - For a touch pad, reports the length of the major axis of an ellipse that
450      * represents the touch area at the point of contact.
451      * The units are device-dependent.
452      */
453     AMOTION_EVENT_AXIS_TOUCH_MAJOR = 4,
454     /**
455      * Axis constant: TouchMinor axis of a motion event.
456      *
457      * - For a touch screen, reports the length of the minor axis of an ellipse that
458      * represents the touch area at the point of contact.
459      * The units are display pixels.
460      * - For a touch pad, reports the length of the minor axis of an ellipse that
461      * represents the touch area at the point of contact.
462      * The units are device-dependent.
463      *
464      * When the touch is circular, the major and minor axis lengths will be equal to one another.
465      */
466     AMOTION_EVENT_AXIS_TOUCH_MINOR = 5,
467     /**
468      * Axis constant: ToolMajor axis of a motion event.
469      *
470      * - For a touch screen, reports the length of the major axis of an ellipse that
471      * represents the size of the approaching finger or tool used to make contact.
472      * - For a touch pad, reports the length of the major axis of an ellipse that
473      * represents the size of the approaching finger or tool used to make contact.
474      * The units are device-dependent.
475      *
476      * When the touch is circular, the major and minor axis lengths will be equal to one another.
477      *
478      * The tool size may be larger than the touch size since the tool may not be fully
479      * in contact with the touch sensor.
480      */
481     AMOTION_EVENT_AXIS_TOOL_MAJOR = 6,
482     /**
483      * Axis constant: ToolMinor axis of a motion event.
484      *
485      * - For a touch screen, reports the length of the minor axis of an ellipse that
486      * represents the size of the approaching finger or tool used to make contact.
487      * - For a touch pad, reports the length of the minor axis of an ellipse that
488      * represents the size of the approaching finger or tool used to make contact.
489      * The units are device-dependent.
490      *
491      * When the touch is circular, the major and minor axis lengths will be equal to one another.
492      *
493      * The tool size may be larger than the touch size since the tool may not be fully
494      * in contact with the touch sensor.
495      */
496     AMOTION_EVENT_AXIS_TOOL_MINOR = 7,
497     /**
498      * Axis constant: Orientation axis of a motion event.
499      *
500      * - For a touch screen or touch pad, reports the orientation of the finger
501      * or tool in radians relative to the vertical plane of the device.
502      * An angle of 0 radians indicates that the major axis of contact is oriented
503      * upwards, is perfectly circular or is of unknown orientation.  A positive angle
504      * indicates that the major axis of contact is oriented to the right.  A negative angle
505      * indicates that the major axis of contact is oriented to the left.
506      * The full range is from -PI/2 radians (finger pointing fully left) to PI/2 radians
507      * (finger pointing fully right).
508      * - For a stylus, the orientation indicates the direction in which the stylus
509      * is pointing in relation to the vertical axis of the current orientation of the screen.
510      * The range is from -PI radians to PI radians, where 0 is pointing up,
511      * -PI/2 radians is pointing left, -PI or PI radians is pointing down, and PI/2 radians
512      * is pointing right.  See also {@link AMOTION_EVENT_AXIS_TILT}.
513      */
514     AMOTION_EVENT_AXIS_ORIENTATION = 8,
515     /**
516      * Axis constant: Vertical Scroll axis of a motion event.
517      *
518      * - For a mouse, reports the relative movement of the vertical scroll wheel.
519      * The value is normalized to a range from -1.0 (down) to 1.0 (up).
520      *
521      * This axis should be used to scroll views vertically.
522      */
523     AMOTION_EVENT_AXIS_VSCROLL = 9,
524     /**
525      * Axis constant: Horizontal Scroll axis of a motion event.
526      *
527      * - For a mouse, reports the relative movement of the horizontal scroll wheel.
528      * The value is normalized to a range from -1.0 (left) to 1.0 (right).
529      *
530      * This axis should be used to scroll views horizontally.
531      */
532     AMOTION_EVENT_AXIS_HSCROLL = 10,
533     /**
534      * Axis constant: Z axis of a motion event.
535      *
536      * - For a joystick, reports the absolute Z position of the joystick.
537      * The value is normalized to a range from -1.0 (high) to 1.0 (low).
538      * <em>On game pads with two analog joysticks, this axis is often reinterpreted
539      * to report the absolute X position of the second joystick instead.</em>
540      */
541     AMOTION_EVENT_AXIS_Z = 11,
542     /**
543      * Axis constant: X Rotation axis of a motion event.
544      *
545      * - For a joystick, reports the absolute rotation angle about the X axis.
546      * The value is normalized to a range from -1.0 (counter-clockwise) to 1.0 (clockwise).
547      */
548     AMOTION_EVENT_AXIS_RX = 12,
549     /**
550      * Axis constant: Y Rotation axis of a motion event.
551      *
552      * - For a joystick, reports the absolute rotation angle about the Y axis.
553      * The value is normalized to a range from -1.0 (counter-clockwise) to 1.0 (clockwise).
554      */
555     AMOTION_EVENT_AXIS_RY = 13,
556     /**
557      * Axis constant: Z Rotation axis of a motion event.
558      *
559      * - For a joystick, reports the absolute rotation angle about the Z axis.
560      * The value is normalized to a range from -1.0 (counter-clockwise) to 1.0 (clockwise).
561      * On game pads with two analog joysticks, this axis is often reinterpreted
562      * to report the absolute Y position of the second joystick instead.
563      */
564     AMOTION_EVENT_AXIS_RZ = 14,
565     /**
566      * Axis constant: Hat X axis of a motion event.
567      *
568      * - For a joystick, reports the absolute X position of the directional hat control.
569      * The value is normalized to a range from -1.0 (left) to 1.0 (right).
570      */
571     AMOTION_EVENT_AXIS_HAT_X = 15,
572     /**
573      * Axis constant: Hat Y axis of a motion event.
574      *
575      * - For a joystick, reports the absolute Y position of the directional hat control.
576      * The value is normalized to a range from -1.0 (up) to 1.0 (down).
577      */
578     AMOTION_EVENT_AXIS_HAT_Y = 16,
579     /**
580      * Axis constant: Left Trigger axis of a motion event.
581      *
582      * - For a joystick, reports the absolute position of the left trigger control.
583      * The value is normalized to a range from 0.0 (released) to 1.0 (fully pressed).
584      */
585     AMOTION_EVENT_AXIS_LTRIGGER = 17,
586     /**
587      * Axis constant: Right Trigger axis of a motion event.
588      *
589      * - For a joystick, reports the absolute position of the right trigger control.
590      * The value is normalized to a range from 0.0 (released) to 1.0 (fully pressed).
591      */
592     AMOTION_EVENT_AXIS_RTRIGGER = 18,
593     /**
594      * Axis constant: Throttle axis of a motion event.
595      *
596      * - For a joystick, reports the absolute position of the throttle control.
597      * The value is normalized to a range from 0.0 (fully open) to 1.0 (fully closed).
598      */
599     AMOTION_EVENT_AXIS_THROTTLE = 19,
600     /**
601      * Axis constant: Rudder axis of a motion event.
602      *
603      * - For a joystick, reports the absolute position of the rudder control.
604      * The value is normalized to a range from -1.0 (turn left) to 1.0 (turn right).
605      */
606     AMOTION_EVENT_AXIS_RUDDER = 20,
607     /**
608      * Axis constant: Wheel axis of a motion event.
609      *
610      * - For a joystick, reports the absolute position of the steering wheel control.
611      * The value is normalized to a range from -1.0 (turn left) to 1.0 (turn right).
612      */
613     AMOTION_EVENT_AXIS_WHEEL = 21,
614     /**
615      * Axis constant: Gas axis of a motion event.
616      *
617      * - For a joystick, reports the absolute position of the gas (accelerator) control.
618      * The value is normalized to a range from 0.0 (no acceleration)
619      * to 1.0 (maximum acceleration).
620      */
621     AMOTION_EVENT_AXIS_GAS = 22,
622     /**
623      * Axis constant: Brake axis of a motion event.
624      *
625      * - For a joystick, reports the absolute position of the brake control.
626      * The value is normalized to a range from 0.0 (no braking) to 1.0 (maximum braking).
627      */
628     AMOTION_EVENT_AXIS_BRAKE = 23,
629     /**
630      * Axis constant: Distance axis of a motion event.
631      *
632      * - For a stylus, reports the distance of the stylus from the screen.
633      * A value of 0.0 indicates direct contact and larger values indicate increasing
634      * distance from the surface.
635      */
636     AMOTION_EVENT_AXIS_DISTANCE = 24,
637     /**
638      * Axis constant: Tilt axis of a motion event.
639      *
640      * - For a stylus, reports the tilt angle of the stylus in radians where
641      * 0 radians indicates that the stylus is being held perpendicular to the
642      * surface, and PI/2 radians indicates that the stylus is being held flat
643      * against the surface.
644      */
645     AMOTION_EVENT_AXIS_TILT = 25,
646     /**
647      * Axis constant:  Generic scroll axis of a motion event.
648      *
649      * - This is used for scroll axis motion events that can't be classified as strictly
650      *   vertical or horizontal. The movement of a rotating scroller is an example of this.
651      */
652     AMOTION_EVENT_AXIS_SCROLL = 26,
653     /**
654      * Axis constant: The movement of x position of a motion event.
655      *
656      * - For a mouse, reports a difference of x position between the previous position.
657      * This is useful when pointer is captured, in that case the mouse pointer doesn't
658      * change the location but this axis reports the difference which allows the app
659      * to see how the mouse is moved.
660      */
661     AMOTION_EVENT_AXIS_RELATIVE_X = 27,
662     /**
663      * Axis constant: The movement of y position of a motion event.
664      *
665      * Same as {@link RELATIVE_X}, but for y position.
666      */
667     AMOTION_EVENT_AXIS_RELATIVE_Y = 28,
668     /**
669      * Axis constant: Generic 1 axis of a motion event.
670      * The interpretation of a generic axis is device-specific.
671      */
672     AMOTION_EVENT_AXIS_GENERIC_1 = 32,
673     /**
674      * Axis constant: Generic 2 axis of a motion event.
675      * The interpretation of a generic axis is device-specific.
676      */
677     AMOTION_EVENT_AXIS_GENERIC_2 = 33,
678     /**
679      * Axis constant: Generic 3 axis of a motion event.
680      * The interpretation of a generic axis is device-specific.
681      */
682     AMOTION_EVENT_AXIS_GENERIC_3 = 34,
683     /**
684      * Axis constant: Generic 4 axis of a motion event.
685      * The interpretation of a generic axis is device-specific.
686      */
687     AMOTION_EVENT_AXIS_GENERIC_4 = 35,
688     /**
689      * Axis constant: Generic 5 axis of a motion event.
690      * The interpretation of a generic axis is device-specific.
691      */
692     AMOTION_EVENT_AXIS_GENERIC_5 = 36,
693     /**
694      * Axis constant: Generic 6 axis of a motion event.
695      * The interpretation of a generic axis is device-specific.
696      */
697     AMOTION_EVENT_AXIS_GENERIC_6 = 37,
698     /**
699      * Axis constant: Generic 7 axis of a motion event.
700      * The interpretation of a generic axis is device-specific.
701      */
702     AMOTION_EVENT_AXIS_GENERIC_7 = 38,
703     /**
704      * Axis constant: Generic 8 axis of a motion event.
705      * The interpretation of a generic axis is device-specific.
706      */
707     AMOTION_EVENT_AXIS_GENERIC_8 = 39,
708     /**
709      * Axis constant: Generic 9 axis of a motion event.
710      * The interpretation of a generic axis is device-specific.
711      */
712     AMOTION_EVENT_AXIS_GENERIC_9 = 40,
713     /**
714      * Axis constant: Generic 10 axis of a motion event.
715      * The interpretation of a generic axis is device-specific.
716      */
717     AMOTION_EVENT_AXIS_GENERIC_10 = 41,
718     /**
719      * Axis constant: Generic 11 axis of a motion event.
720      * The interpretation of a generic axis is device-specific.
721      */
722     AMOTION_EVENT_AXIS_GENERIC_11 = 42,
723     /**
724      * Axis constant: Generic 12 axis of a motion event.
725      * The interpretation of a generic axis is device-specific.
726      */
727     AMOTION_EVENT_AXIS_GENERIC_12 = 43,
728     /**
729      * Axis constant: Generic 13 axis of a motion event.
730      * The interpretation of a generic axis is device-specific.
731      */
732     AMOTION_EVENT_AXIS_GENERIC_13 = 44,
733     /**
734      * Axis constant: Generic 14 axis of a motion event.
735      * The interpretation of a generic axis is device-specific.
736      */
737     AMOTION_EVENT_AXIS_GENERIC_14 = 45,
738     /**
739      * Axis constant: Generic 15 axis of a motion event.
740      * The interpretation of a generic axis is device-specific.
741      */
742     AMOTION_EVENT_AXIS_GENERIC_15 = 46,
743     /**
744      * Axis constant: Generic 16 axis of a motion event.
745      * The interpretation of a generic axis is device-specific.
746      */
747     AMOTION_EVENT_AXIS_GENERIC_16 = 47,
748 
749     // NOTE: If you add a new axis here you must also add it to several other files.
750     //       Refer to frameworks/base/core/java/android/view/MotionEvent.java for the full list.
751 }
752 
753 /**
754  * Constants that identify buttons that are associated with motion events.
755  * Refer to the documentation on the MotionEvent class for descriptions of each button.
756  */
757 enum {
758     /** primary */
759     AMOTION_EVENT_BUTTON_PRIMARY = 1 << 0,
760     /** secondary */
761     AMOTION_EVENT_BUTTON_SECONDARY = 1 << 1,
762     /** tertiary */
763     AMOTION_EVENT_BUTTON_TERTIARY = 1 << 2,
764     /** back */
765     AMOTION_EVENT_BUTTON_BACK = 1 << 3,
766     /** forward */
767     AMOTION_EVENT_BUTTON_FORWARD = 1 << 4,
768     AMOTION_EVENT_BUTTON_STYLUS_PRIMARY = 1 << 5,
769     AMOTION_EVENT_BUTTON_STYLUS_SECONDARY = 1 << 6,
770 }
771 
772 /**
773  * Constants that identify tool types.
774  * Refer to the documentation on the MotionEvent class for descriptions of each tool type.
775  */
776 enum {
777     /** unknown */
778     AMOTION_EVENT_TOOL_TYPE_UNKNOWN = 0,
779     /** finger */
780     AMOTION_EVENT_TOOL_TYPE_FINGER = 1,
781     /** stylus */
782     AMOTION_EVENT_TOOL_TYPE_STYLUS = 2,
783     /** mouse */
784     AMOTION_EVENT_TOOL_TYPE_MOUSE = 3,
785     /** eraser */
786     AMOTION_EVENT_TOOL_TYPE_ERASER = 4,
787     /** palm */
788     AMOTION_EVENT_TOOL_TYPE_PALM = 5,
789 }
790 
791 /**
792  * Input source masks.
793  *
794  * Refer to the documentation on android.view.InputDevice for more details about input sources
795  * and their correct interpretation.
796  */
797 enum {
798     /** mask */
799     AINPUT_SOURCE_CLASS_MASK = 0x000000ff,
800 
801     /** none */
802     AINPUT_SOURCE_CLASS_NONE = 0x00000000,
803     /** button */
804     AINPUT_SOURCE_CLASS_BUTTON = 0x00000001,
805     /** pointer */
806     AINPUT_SOURCE_CLASS_POINTER = 0x00000002,
807     /** navigation */
808     AINPUT_SOURCE_CLASS_NAVIGATION = 0x00000004,
809     /** position */
810     AINPUT_SOURCE_CLASS_POSITION = 0x00000008,
811     /** joystick */
812     AINPUT_SOURCE_CLASS_JOYSTICK = 0x00000010,
813 }
814 
815 /**
816  * Input sources.
817  */
818 enum {
819     /** unknown */
820     AINPUT_SOURCE_UNKNOWN = 0x00000000,
821 
822     /** keyboard */
823     AINPUT_SOURCE_KEYBOARD = 0x00000100 | AINPUT_SOURCE_CLASS_BUTTON,
824     /** dpad */
825     AINPUT_SOURCE_DPAD = 0x00000200 | AINPUT_SOURCE_CLASS_BUTTON,
826     /** gamepad */
827     AINPUT_SOURCE_GAMEPAD = 0x00000400 | AINPUT_SOURCE_CLASS_BUTTON,
828     /** touchscreen */
829     AINPUT_SOURCE_TOUCHSCREEN = 0x00001000 | AINPUT_SOURCE_CLASS_POINTER,
830     /** mouse */
831     AINPUT_SOURCE_MOUSE = 0x00002000 | AINPUT_SOURCE_CLASS_POINTER,
832     /** stylus */
833     AINPUT_SOURCE_STYLUS = 0x00004000 | AINPUT_SOURCE_CLASS_POINTER,
834     /** bluetooth stylus */
835     AINPUT_SOURCE_BLUETOOTH_STYLUS = 0x00008000 | AINPUT_SOURCE_STYLUS,
836     /** trackball */
837     AINPUT_SOURCE_TRACKBALL = 0x00010000 | AINPUT_SOURCE_CLASS_NAVIGATION,
838     /** mouse relative */
839     AINPUT_SOURCE_MOUSE_RELATIVE = 0x00020000 | AINPUT_SOURCE_CLASS_NAVIGATION,
840     /** touchpad */
841     AINPUT_SOURCE_TOUCHPAD = 0x00100000 | AINPUT_SOURCE_CLASS_POSITION,
842     /** navigation */
843     AINPUT_SOURCE_TOUCH_NAVIGATION = 0x00200000 | AINPUT_SOURCE_CLASS_NONE,
844     /** joystick */
845     AINPUT_SOURCE_JOYSTICK = 0x01000000 | AINPUT_SOURCE_CLASS_JOYSTICK,
846     /** rotary encoder */
847     AINPUT_SOURCE_ROTARY_ENCODER = 0x00400000 | AINPUT_SOURCE_CLASS_NONE,
848 
849     /** any */
850     AINPUT_SOURCE_ANY = 0xffffff00,
851 }
852 
853 /**
854  * Keyboard types.
855  *
856  * Refer to the documentation on android.view.InputDevice for more details.
857  */
858 enum {
859     /** none */
860     AINPUT_KEYBOARD_TYPE_NONE = 0,
861     /** non alphabetic */
862     AINPUT_KEYBOARD_TYPE_NON_ALPHABETIC = 1,
863     /** alphabetic */
864     AINPUT_KEYBOARD_TYPE_ALPHABETIC = 2,
865 }
866 
867 /**
868  * Constants used to retrieve information about the range of motion for a particular
869  * coordinate of a motion event.
870  *
871  * Refer to the documentation on android.view.InputDevice for more details about input sources
872  * and their correct interpretation.
873  *
874  * @deprecated These constants are deprecated. Use {@link AMOTION_EVENT_AXIS AMOTION_EVENT_AXIS_*} constants instead.
875  */
876 enum {
877     /** x */
878     AINPUT_MOTION_RANGE_X = AMOTION_EVENT_AXIS_X,
879     /** y */
880     AINPUT_MOTION_RANGE_Y = AMOTION_EVENT_AXIS_Y,
881     /** pressure */
882     AINPUT_MOTION_RANGE_PRESSURE = AMOTION_EVENT_AXIS_PRESSURE,
883     /** size */
884     AINPUT_MOTION_RANGE_SIZE = AMOTION_EVENT_AXIS_SIZE,
885     /** touch major */
886     AINPUT_MOTION_RANGE_TOUCH_MAJOR = AMOTION_EVENT_AXIS_TOUCH_MAJOR,
887     /** touch minor */
888     AINPUT_MOTION_RANGE_TOUCH_MINOR = AMOTION_EVENT_AXIS_TOUCH_MINOR,
889     /** tool major */
890     AINPUT_MOTION_RANGE_TOOL_MAJOR = AMOTION_EVENT_AXIS_TOOL_MAJOR,
891     /** tool minor */
892     AINPUT_MOTION_RANGE_TOOL_MINOR = AMOTION_EVENT_AXIS_TOOL_MINOR,
893     /** orientation */
894     AINPUT_MOTION_RANGE_ORIENTATION = AMOTION_EVENT_AXIS_ORIENTATION,
895 }
896 
897 
898 /**
899  * Input event accessors.
900  *
901  * Note that most functions can only be used on input events that are of a given type.
902  * Calling these functions on input events of other types will yield undefined behavior.
903  */
904 
905 /*** Accessors for all input events. ***/
906 
907 /** Get the input event type. */
908 int32_t AInputEvent_getType(const AInputEvent* event);
909 
910 /** Get the id for the device that an input event came from.
911  *
912  * Input events can be generated by multiple different input devices.
913  * Use the input device id to obtain information about the input
914  * device that was responsible for generating a particular event.
915  *
916  * An input device id of 0 indicates that the event didn't come from a physical device;
917  * other numbers are arbitrary and you shouldn't depend on the values.
918  * Use the provided input device query API to obtain information about input devices.
919  */
920 int32_t AInputEvent_getDeviceId(const AInputEvent* event);
921 
922 /** Get the input event source. */
923 int32_t AInputEvent_getSource(const AInputEvent* event);
924 
925 /*** Accessors for key events only. ***/
926 
927 /** Get the key event action. */
928 int32_t AKeyEvent_getAction(const AInputEvent* key_event);
929 
930 /** Get the key event flags. */
931 int32_t AKeyEvent_getFlags(const AInputEvent* key_event);
932 
933 /**
934  * Get the key code of the key event.
935  * This is the physical key that was pressed, not the Unicode character.
936  */
937 int32_t AKeyEvent_getKeyCode(const AInputEvent* key_event);
938 
939 /**
940  * Get the hardware key id of this key event.
941  * These values are not reliable and vary from device to device.
942  */
943 int32_t AKeyEvent_getScanCode(const AInputEvent* key_event);
944 
945 /** Get the meta key state. */
946 int32_t AKeyEvent_getMetaState(const AInputEvent* key_event);
947 
948 /**
949  * Get the repeat count of the event.
950  * For both key up an key down events, this is the number of times the key has
951  * repeated with the first down starting at 0 and counting up from there.  For
952  * multiple key events, this is the number of down/up pairs that have occurred.
953  */
954 int32_t AKeyEvent_getRepeatCount(const AInputEvent* key_event);
955 
956 /**
957  * Get the time of the most recent key down event, in the
958  * java.lang.System.nanoTime() time base.  If this is a down event,
959  * this will be the same as eventTime.
960  * Note that when chording keys, this value is the down time of the most recently
961  * pressed key, which may not be the same physical key of this event.
962  */
963 int64_t AKeyEvent_getDownTime(const AInputEvent* key_event);
964 
965 /**
966  * Get the time this event occurred, in the
967  * java.lang.System.nanoTime() time base.
968  */
969 int64_t AKeyEvent_getEventTime(const AInputEvent* key_event);
970 
971 /*** Accessors for motion events only. ***/
972 
973 /** Get the combined motion event action code and pointer index. */
974 int32_t AMotionEvent_getAction(const AInputEvent* motion_event);
975 
976 /** Get the motion event flags. */
977 int32_t AMotionEvent_getFlags(const AInputEvent* motion_event);
978 
979 /**
980  * Get the state of any meta / modifier keys that were in effect when the
981  * event was generated.
982  */
983 int32_t AMotionEvent_getMetaState(const AInputEvent* motion_event);
984 
985 /** Get the button state of all buttons that are pressed. */
986 int32_t AMotionEvent_getButtonState(const AInputEvent* motion_event);
987 
988 /**
989  * Get a bitfield indicating which edges, if any, were touched by this motion event.
990  * For touch events, clients can use this to determine if the user's finger was
991  * touching the edge of the display.
992  */
993 int32_t AMotionEvent_getEdgeFlags(const AInputEvent* motion_event);
994 
995 /**
996  * Get the time when the user originally pressed down to start a stream of
997  * position events, in the java.lang.System.nanoTime() time base.
998  */
999 int64_t AMotionEvent_getDownTime(const AInputEvent* motion_event);
1000 
1001 /**
1002  * Get the time when this specific event was generated,
1003  * in the java.lang.System.nanoTime() time base.
1004  */
1005 int64_t AMotionEvent_getEventTime(const AInputEvent* motion_event);
1006 
1007 /**
1008  * Get the X coordinate offset.
1009  * For touch events on the screen, this is the delta that was added to the raw
1010  * screen coordinates to adjust for the absolute position of the containing windows
1011  * and views.
1012  */
1013 float AMotionEvent_getXOffset(const AInputEvent* motion_event);
1014 
1015 /**
1016  * Get the Y coordinate offset.
1017  * For touch events on the screen, this is the delta that was added to the raw
1018  * screen coordinates to adjust for the absolute position of the containing windows
1019  * and views.
1020  */
1021 float AMotionEvent_getYOffset(const AInputEvent* motion_event);
1022 
1023 /**
1024  * Get the precision of the X coordinates being reported.
1025  * You can multiply this number with an X coordinate sample to find the
1026  * actual hardware value of the X coordinate.
1027  */
1028 float AMotionEvent_getXPrecision(const AInputEvent* motion_event);
1029 
1030 /**
1031  * Get the precision of the Y coordinates being reported.
1032  * You can multiply this number with a Y coordinate sample to find the
1033  * actual hardware value of the Y coordinate.
1034  */
1035 float AMotionEvent_getYPrecision(const AInputEvent* motion_event);
1036 
1037 /**
1038  * Get the number of pointers of data contained in this event.
1039  * Always >= 1.
1040  */
1041 size_t AMotionEvent_getPointerCount(const AInputEvent* motion_event);
1042 
1043 /**
1044  * Get the pointer identifier associated with a particular pointer
1045  * data index in this event.  The identifier tells you the actual pointer
1046  * number associated with the data, accounting for individual pointers
1047  * going up and down since the start of the current gesture.
1048  */
1049 int32_t AMotionEvent_getPointerId(const AInputEvent* motion_event, size_t pointer_index);
1050 
1051 /**
1052  * Get the tool type of a pointer for the given pointer index.
1053  * The tool type indicates the type of tool used to make contact such as a
1054  * finger or stylus, if known.
1055  */
1056 int32_t AMotionEvent_getToolType(const AInputEvent* motion_event, size_t pointer_index);
1057 
1058 /**
1059  * Get the original raw X coordinate of this event.
1060  * For touch events on the screen, this is the original location of the event
1061  * on the screen, before it had been adjusted for the containing window
1062  * and views.
1063  */
1064 float AMotionEvent_getRawX(const AInputEvent* motion_event, size_t pointer_index);
1065 
1066 /**
1067  * Get the original raw X coordinate of this event.
1068  * For touch events on the screen, this is the original location of the event
1069  * on the screen, before it had been adjusted for the containing window
1070  * and views.
1071  */
1072 float AMotionEvent_getRawY(const AInputEvent* motion_event, size_t pointer_index);
1073 
1074 /**
1075  * Get the current X coordinate of this event for the given pointer index.
1076  * Whole numbers are pixels; the value may have a fraction for input devices
1077  * that are sub-pixel precise.
1078  */
1079 float AMotionEvent_getX(const AInputEvent* motion_event, size_t pointer_index);
1080 
1081 /**
1082  * Get the current Y coordinate of this event for the given pointer index.
1083  * Whole numbers are pixels; the value may have a fraction for input devices
1084  * that are sub-pixel precise.
1085  */
1086 float AMotionEvent_getY(const AInputEvent* motion_event, size_t pointer_index);
1087 
1088 /**
1089  * Get the current pressure of this event for the given pointer index.
1090  * The pressure generally ranges from 0 (no pressure at all) to 1 (normal pressure),
1091  * although values higher than 1 may be generated depending on the calibration of
1092  * the input device.
1093  */
1094 float AMotionEvent_getPressure(const AInputEvent* motion_event, size_t pointer_index);
1095 
1096 /**
1097  * Get the current scaled value of the approximate size for the given pointer index.
1098  * This represents some approximation of the area of the screen being
1099  * pressed; the actual value in pixels corresponding to the
1100  * touch is normalized with the device specific range of values
1101  * and scaled to a value between 0 and 1.  The value of size can be used to
1102  * determine fat touch events.
1103  */
1104 float AMotionEvent_getSize(const AInputEvent* motion_event, size_t pointer_index);
1105 
1106 /**
1107  * Get the current length of the major axis of an ellipse that describes the touch area
1108  * at the point of contact for the given pointer index.
1109  */
1110 float AMotionEvent_getTouchMajor(const AInputEvent* motion_event, size_t pointer_index);
1111 
1112 /**
1113  * Get the current length of the minor axis of an ellipse that describes the touch area
1114  * at the point of contact for the given pointer index.
1115  */
1116 float AMotionEvent_getTouchMinor(const AInputEvent* motion_event, size_t pointer_index);
1117 
1118 /**
1119  * Get the current length of the major axis of an ellipse that describes the size
1120  * of the approaching tool for the given pointer index.
1121  * The tool area represents the estimated size of the finger or pen that is
1122  * touching the device independent of its actual touch area at the point of contact.
1123  */
1124 float AMotionEvent_getToolMajor(const AInputEvent* motion_event, size_t pointer_index);
1125 
1126 /**
1127  * Get the current length of the minor axis of an ellipse that describes the size
1128  * of the approaching tool for the given pointer index.
1129  * The tool area represents the estimated size of the finger or pen that is
1130  * touching the device independent of its actual touch area at the point of contact.
1131  */
1132 float AMotionEvent_getToolMinor(const AInputEvent* motion_event, size_t pointer_index);
1133 
1134 /**
1135  * Get the current orientation of the touch area and tool area in radians clockwise from
1136  * vertical for the given pointer index.
1137  * An angle of 0 degrees indicates that the major axis of contact is oriented
1138  * upwards, is perfectly circular or is of unknown orientation.  A positive angle
1139  * indicates that the major axis of contact is oriented to the right.  A negative angle
1140  * indicates that the major axis of contact is oriented to the left.
1141  * The full range is from -PI/2 radians (finger pointing fully left) to PI/2 radians
1142  * (finger pointing fully right).
1143  */
1144 float AMotionEvent_getOrientation(const AInputEvent* motion_event, size_t pointer_index);
1145 
1146 /** Get the value of the request axis for the given pointer index. */
1147 float AMotionEvent_getAxisValue(const AInputEvent* motion_event,
1148         int32_t axis, size_t pointer_index);
1149 
1150 /**
1151  * Get the number of historical points in this event.  These are movements that
1152  * have occurred between this event and the previous event.  This only applies
1153  * to AMOTION_EVENT_ACTION_MOVE events -- all other actions will have a size of 0.
1154  * Historical samples are indexed from oldest to newest.
1155  */
1156 size_t AMotionEvent_getHistorySize(const AInputEvent* motion_event);
1157 
1158 /**
1159  * Get the time that a historical movement occurred between this event and
1160  * the previous event, in the java.lang.System.nanoTime() time base.
1161  */
1162 int64_t AMotionEvent_getHistoricalEventTime(const AInputEvent* motion_event,
1163         size_t history_index);
1164 
1165 /**
1166  * Get the historical raw X coordinate of this event for the given pointer index that
1167  * occurred between this event and the previous motion event.
1168  * For touch events on the screen, this is the original location of the event
1169  * on the screen, before it had been adjusted for the containing window
1170  * and views.
1171  * Whole numbers are pixels; the value may have a fraction for input devices
1172  * that are sub-pixel precise.
1173  */
1174 float AMotionEvent_getHistoricalRawX(const AInputEvent* motion_event, size_t pointer_index,
1175         size_t history_index);
1176 
1177 /**
1178  * Get the historical raw Y coordinate of this event for the given pointer index that
1179  * occurred between this event and the previous motion event.
1180  * For touch events on the screen, this is the original location of the event
1181  * on the screen, before it had been adjusted for the containing window
1182  * and views.
1183  * Whole numbers are pixels; the value may have a fraction for input devices
1184  * that are sub-pixel precise.
1185  */
1186 float AMotionEvent_getHistoricalRawY(const AInputEvent* motion_event, size_t pointer_index,
1187         size_t history_index);
1188 
1189 /**
1190  * Get the historical X coordinate of this event for the given pointer index that
1191  * occurred between this event and the previous motion event.
1192  * Whole numbers are pixels; the value may have a fraction for input devices
1193  * that are sub-pixel precise.
1194  */
1195 float AMotionEvent_getHistoricalX(const AInputEvent* motion_event, size_t pointer_index,
1196         size_t history_index);
1197 
1198 /**
1199  * Get the historical Y coordinate of this event for the given pointer index that
1200  * occurred between this event and the previous motion event.
1201  * Whole numbers are pixels; the value may have a fraction for input devices
1202  * that are sub-pixel precise.
1203  */
1204 float AMotionEvent_getHistoricalY(const AInputEvent* motion_event, size_t pointer_index,
1205         size_t history_index);
1206 
1207 /**
1208  * Get the historical pressure of this event for the given pointer index that
1209  * occurred between this event and the previous motion event.
1210  * The pressure generally ranges from 0 (no pressure at all) to 1 (normal pressure),
1211  * although values higher than 1 may be generated depending on the calibration of
1212  * the input device.
1213  */
1214 float AMotionEvent_getHistoricalPressure(const AInputEvent* motion_event, size_t pointer_index,
1215         size_t history_index);
1216 
1217 /**
1218  * Get the current scaled value of the approximate size for the given pointer index that
1219  * occurred between this event and the previous motion event.
1220  * This represents some approximation of the area of the screen being
1221  * pressed; the actual value in pixels corresponding to the
1222  * touch is normalized with the device specific range of values
1223  * and scaled to a value between 0 and 1.  The value of size can be used to
1224  * determine fat touch events.
1225  */
1226 float AMotionEvent_getHistoricalSize(const AInputEvent* motion_event, size_t pointer_index,
1227         size_t history_index);
1228 
1229 /**
1230  * Get the historical length of the major axis of an ellipse that describes the touch area
1231  * at the point of contact for the given pointer index that
1232  * occurred between this event and the previous motion event.
1233  */
1234 float AMotionEvent_getHistoricalTouchMajor(const AInputEvent* motion_event, size_t pointer_index,
1235         size_t history_index);
1236 
1237 /**
1238  * Get the historical length of the minor axis of an ellipse that describes the touch area
1239  * at the point of contact for the given pointer index that
1240  * occurred between this event and the previous motion event.
1241  */
1242 float AMotionEvent_getHistoricalTouchMinor(const AInputEvent* motion_event, size_t pointer_index,
1243         size_t history_index);
1244 
1245 /**
1246  * Get the historical length of the major axis of an ellipse that describes the size
1247  * of the approaching tool for the given pointer index that
1248  * occurred between this event and the previous motion event.
1249  * The tool area represents the estimated size of the finger or pen that is
1250  * touching the device independent of its actual touch area at the point of contact.
1251  */
1252 float AMotionEvent_getHistoricalToolMajor(const AInputEvent* motion_event, size_t pointer_index,
1253         size_t history_index);
1254 
1255 /**
1256  * Get the historical length of the minor axis of an ellipse that describes the size
1257  * of the approaching tool for the given pointer index that
1258  * occurred between this event and the previous motion event.
1259  * The tool area represents the estimated size of the finger or pen that is
1260  * touching the device independent of its actual touch area at the point of contact.
1261  */
1262 float AMotionEvent_getHistoricalToolMinor(const AInputEvent* motion_event, size_t pointer_index,
1263         size_t history_index);
1264 
1265 /**
1266  * Get the historical orientation of the touch area and tool area in radians clockwise from
1267  * vertical for the given pointer index that
1268  * occurred between this event and the previous motion event.
1269  * An angle of 0 degrees indicates that the major axis of contact is oriented
1270  * upwards, is perfectly circular or is of unknown orientation.  A positive angle
1271  * indicates that the major axis of contact is oriented to the right.  A negative angle
1272  * indicates that the major axis of contact is oriented to the left.
1273  * The full range is from -PI/2 radians (finger pointing fully left) to PI/2 radians
1274  * (finger pointing fully right).
1275  */
1276 float AMotionEvent_getHistoricalOrientation(const AInputEvent* motion_event, size_t pointer_index,
1277         size_t history_index);
1278 
1279 /**
1280  * Get the historical value of the request axis for the given pointer index
1281  * that occurred between this event and the previous motion event.
1282  */
1283 float AMotionEvent_getHistoricalAxisValue(const AInputEvent* motion_event,
1284         int32_t axis, size_t pointer_index, size_t history_index);
1285 
1286 
1287 /**
1288  * Input queue
1289  *
1290  * An input queue is the facility through which you retrieve input
1291  * events.
1292  */
1293 struct AInputQueue;
1294 
1295 /**
1296  * Add this input queue to a looper for processing.  See
1297  * ALooper_addFd() for information on the ident, callback, and data params.
1298  */
1299 void AInputQueue_attachLooper(AInputQueue* queue, ALooper* looper,
1300         int ident, ALooper_callbackFunc callback, void* data);
1301 
1302 /**
1303  * Remove the input queue from the looper it is currently attached to.
1304  */
1305 void AInputQueue_detachLooper(AInputQueue* queue);
1306 
1307 /**
1308  * Returns true if there are one or more events available in the
1309  * input queue.  Returns 1 if the queue has events; 0 if
1310  * it does not have events; and a negative value if there is an error.
1311  */
1312 int32_t AInputQueue_hasEvents(AInputQueue* queue);
1313 
1314 /**
1315  * Returns the next available event from the queue.  Returns a negative
1316  * value if no events are available or an error has occurred.
1317  */
1318 int32_t AInputQueue_getEvent(AInputQueue* queue, AInputEvent** outEvent);
1319 
1320 /**
1321  * Sends the key for standard pre-dispatching -- that is, possibly deliver
1322  * it to the current IME to be consumed before the app.  Returns 0 if it
1323  * was not pre-dispatched, meaning you can process it right now.  If non-zero
1324  * is returned, you must abandon the current event processing and allow the
1325  * event to appear again in the event queue (if it does not get consumed during
1326  * pre-dispatching).
1327  */
1328 int32_t AInputQueue_preDispatchEvent(AInputQueue* queue, AInputEvent* event);
1329 
1330 /**
1331  * Report that dispatching has finished with the given event.
1332  * This must be called after receiving an event with AInputQueue_get_event().
1333  */
1334 void AInputQueue_finishEvent(AInputQueue* queue, AInputEvent* event, int handled);